
#include "Data.h"


/*
class data{
public:
    data(int year = 2016, int month = 9, int day = 25){
        _year = year;
        _month = month;
        _day = day;
    }

    data(const data& d){
        cout << "data(const data& d)" << endl;
        _year = d._year;
        _month = d._month;
        _day = d._day;
    }

    void Print(){
        cout << _year << "/" << _month << "/" << _day << endl;
    }

private:
    int _year;
    int _month;
    int _day;
};
*/

typedef int DataType;
class Stack{
public:
    Stack(size_t capacity = 10){
        cout << "Stack(size_t capacity = 10)" << endl;
        _array = (DataType*) malloc(sizeof(DataType)*capacity);
        if(_array == nullptr){
            perror("malloc fail");
            exit(-1);
        }
        _size = 0;
        _capacity = capacity;
    }

    //用引用尽量把const加上
    void Push(const DataType& data){
        _array[_size] = data;
        _size++;
    }

    Stack(const Stack& st){
        cout << "Stack(const Stack& st)" << endl;
        _array = (DataType*) malloc(sizeof(DataType)*st._capacity);
        if(_array == nullptr){
            perror("malloc fail");
            exit(-1);
        }
        memcpy(_array,st._array, sizeof(DataType)*st._size);
        _size = st._size;
        _capacity = st._capacity;
    }

    ~Stack(){
        cout << "~Stack()" << endl;
        if(_array){
            free(_array);
            _array = nullptr;
            _size = 0;
            _capacity = 0;
        }
    }

private:
    DataType *_array;
    size_t _size;
    size_t _capacity;
};

class MyQueue{
public:
    //默认生成构造
    //默认生成析构
    //默认生成拷贝构造
private:
    Stack _pushST;
    Stack _popST;
    int _size = 0;
};

/*
int main() {

*/
/*    data d1(2023,3,19);
    d1.Print();

    data d2(d1);
    d2.Print();
    data d3 = d1;*//*
*/
/*


*//*

*/
/*
    Stack st1;
    st1.Push(6);
    st1.Push(9);
    Stack st2(5);
    Stack st3(st1);
*//*


    MyQueue q1;
    MyQueue q2(q1);

    return 0;
}
*/


void TestData1(){
    Data d1(2023,3,19);
    cout << d1;
    Data d2 = d1 + 150;
    cout << d1 << d2 << endl;
}

void TestData2(){
    Data d1;
    cout << d1;
    cin >> d1;
    cout << d1;
}

void TestData3(){
    Data d1;
}

/*
int main(){
*/
/*    Data d1;
    d1.Print();
    Data d2(2023,3,19);
    d2.Print();

    Data d3 = d2 + 100;
    d3.Print();

    Data d4(d2);
    d4 += 200;
    d4.Print();

    Data d5;
    d5.Print();
    ++d5;
    d5.Print();
    d5++;
    d5.Print();

    int gap = d2 - d1;
    cout << gap << endl;

    int gap1 = d3 - d2;
    cout << gap1 << endl;
    *//*


    TestData3();

    return 0;
}
*/
